package lesson16;


public class Person {
	private String name;
	private String password;
	private int age;
	private String egn;

	private Person()
	{
		this.name = "unknown";
		this.age = 0;
	}
	
	public Person(String egn, String password)
	{
		this();
		this.egn = egn;
		setPassword(password);
		
	}
	
	public void changePassword(String oldPassword, String newPassword)
	{
		if(this.password.equals(oldPassword))
			this.password = newPassword;
		else
			System.out.println("Different passwords0 ");
	}
	
	public void setPassword(String password)
	{
		this.password = password;
	}
	
	public String getName(String password)
	{
		if(this.password.equals(password))
			return this.name;
		else
			return "Wrong password";
	}
}
